<template>
	<view>
		<view class="plr20 box_b">
			<view class="conBox bgfff pb30 plr30 box_b mt20">
				<view class="flex_between flex_items f30 pt20 mt15">
					<view>姓名</view>
					<view>{{detail.name}}</view>
				</view>
				<view class="flex_between flex_items f30 pt20 mt15">
					<view>手机号</view>
					<view>{{detail.phone}}</view>
				</view>
				<view class="flex_between flex_items f30 pt20 mt15">
					<view>身份证号</view>
					<view>{{detail.id_card}}</view>
				</view>
				<view class="flex_between flex_items f30 pt20 mt15">
					<view>报名人数</view>
					<view>{{detail.peoples}}</view>
				</view>
				<view class="flex_between flex_items f30 pt20 mt15">
					<view>预约日期</view>
					<view>{{detail.appdate}}</view>
				</view>
				<view class="flex_between flex_items f30 pt20 mt15">
					<view>预约时间</view>
					<view>{{detail.apptime}}</view>
				</view>
				<view class="flex_between f30 pt20 mt15">
					<view class="flex_shrink pr30 box_b">备注</view>
					<view v-if="detail.remark"><text class="txt_word word_break">{{detail.remark}}</text></view>
					<view class="c9" v-else>无</view>
				</view>
				<view class="flex_between flex_items f30 pt20 mt15">
					<view>报名时间</view>
					<view>{{detail.addtime}}</view>
				</view>

				<view class="bte9s mt30"></view>
				<view @click="confirm" class="bbtn flex_center flex_items">
					<view class="f32 cf bold">确认核销</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	let common = getApp().globalData.commonFun;
	let util = getApp().globalData.utilFun;
	export default {
		components: {},
		data() {
			return {
				imghttp: getApp().globalData.imghttp,
				detail: {},
				id: "",
			}
		},
		async onLoad(option) {
			this.id = option.id
			common.showLoading("加载中...");
			this.getData();
		},
		methods: {
			async confirm() {
				let val = {
					id: this.id,
					statusid: 3
				}
				let url = 'arts/edit';
				let res = await util.httpRequest(url, val, "POST");
				common.hideLoading();
				if (res.result == "fail") {
					if (res.code == 401) {
						common.setStorage('openurl', 'pages/hexiao/hexiao')
						uni.redirectTo({
							url: "/pages/adminLogin/adminLogin"
						})
						return;
					}
					common.showTimeToast(res.msg);
					return;
				}
				common.showTimeToast("核销成功");
				setTimeout((rs) => {
					uni.redirectTo({
						url: "/pages/enrollList/enrollList"
					})
				}, 2000)
			},
			async getData() {
				let val = {
					id: this.id
				}
				let url = 'arts/detail';
				let res = await util.httpRequest(url, val);
				common.hideLoading();
				if (res.result == "fail") {
					if (res.code == 401) {
						common.setStorage('openurl', '/pages/hexiao/hexiao?id=' + this.id)
						uni.redirectTo({
							url: "/pages/adminLogin/adminLogin"
						})
						return;
					}
					common.showTimeToast(res.msg);
					return;
				}
				this.detail = res.results
			}
		},
	}
</script>

<style>
	page {
		background: #f8f8f8;
	}
</style>
<style scoped>
	Page {
		background: #f8f8f8;
	}

	.color1 {
		color: #15a183;
	}

	.color2 {
		color: #ff4141;
	}

	.bbtn {
		width: 100%;
		height: 90rpx;
		background: #15a183;
		border-radius: 45rpx;
		margin: 0 auto;
		margin-top: 40rpx;
	}
</style>